package com.go.where.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.go.where.manager.dao.CustomerCommentDao;
import com.go.where.manager.page.Pagination;
import com.go.where.manager.pojo.CustomerCommentInfo;
import com.go.where.manager.service.CustomerCommentService;

@Service("customerCommentService")
public class CustomerCommentServiceImpl implements CustomerCommentService {

	@Resource(name = "customerCommentDao")
	private CustomerCommentDao customerCommentDao;

	@Override
	public CustomerCommentInfo queryByPrimartKey(String cid) {
		return customerCommentDao.getByKey(cid);
	}

	@Override
	public Pagination<CustomerCommentInfo> queryPage(
			CustomerCommentInfo customerInfo) {
		Integer count = customerCommentDao.totalCount(customerInfo);
		customerInfo.calculate();
		List<CustomerCommentInfo> list = customerCommentDao
				.queryList(customerInfo);
		Pagination<CustomerCommentInfo> page = customerCommentDao
				.queryPagination(count, list, customerInfo);
		return page;
	}

	@Override
	public int update(CustomerCommentInfo customerInfo) {
		return customerCommentDao.update(customerInfo);
	}

}
